# Maintainer:
pkgname=nomacs
pkgver=3.14.2
pkgrel=0
pkgdesc="Small and fast Qt image viewer"
url="https://nomacs.org/"
arch="all"
license="GPL-3.0-or-later"
depends="qt5-qtimageformats"
makedepends="cmake
	qt5-qtbase-dev
	qt5-qttools-dev
	qt5-qtsvg-dev
	exiv2-dev
	quazip-dev
	libwebp-dev
	lcov
	libzip-dev"
subpackages="$pkgname-doc $pkgname-lang"
options="!check" # no test suite
source="$pkgname-$pkgver.tar.gz::https://github.com/nomacs/nomacs/archive/$pkgver.tar.gz
	fix-std-cout.patch"
builddir="$srcdir/$pkgname-$pkgver/ImageLounge"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DENABLE_OPENCV=False \
		-DENABLE_RAW=False \
		-DENABLE_TIFF=False \
		-DENABLE_QT_DEBUG=False \
		-DENABLE_TRANSLATIONS=True \
		-DENABLE_PLUGINS=False \
		-DUSE_SYSTEM_QUAZIP=True \
		${CMAKE_CROSSOPTS} .
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

lang() {
	pkgdesc="Languages for package $pkgname"
	depends=""
	local langdir="usr/share/$pkgname/Image Lounge/translations"

	mkdir -p "$subpkgdir"/"$langdir"
	mv "$pkgdir"/"$langdir"/* "$subpkgdir"/"$langdir"/
}

sha512sums="58104c85078bdbff7f65625658bb01b152631470eea93a43494eed55ae5e2441b7bcf3ed6c8f1aef07831bc99c80af94467fcc0e15dc1d282ef313bfcb3c81e9  nomacs-3.14.2.tar.gz
1530398feaa341687fd5e0117507b2262d46deb3052988e97156beee81d9611c8035be03ab616868a2dcff93fa5e82279f6a73af7edc70630451cfa28f9a4765  fix-std-cout.patch"
